<?php session_start();
	include('../controller/functions.php');
	User::connection();


	$userArr	= array('admin','student','teacher');
	if(!in_array($_SESSION['user'],$userArr)) {
	User::validSession();

}
if ($_GET['q'] == 'logout') 
{
	User::user_logout();
	print '		
			<script type="text/javascript">		
			window.location = "../login_r.php";
			</script>
			';

}
$email = $_SESSION['em'];

	if (isset ($_GET['id'])) {
		$userid	= $_GET['id'];
	
	}	
	
	$whatName = mysql_query("SELECT fname,lname,mname FROM `tbluser` WHERE userid = '$userid'");
	while ($rowName = mysql_fetch_assoc($whatName)):
	$fullname = $rowName['lname'].", ". $rowName['fname']. $rowName['mname'];
	endwhile;
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="shortcut icon" href="../images/fav.ico">
<link rel="icon" type="image/gif" href="../images/fav.ico">
<title>View User : <? print($fullname); ?></title>

	<link rel="stylesheet" href="../css/style2.css" type="text/css" charset="utf-8" />
    <link rel="stylesheet" href="../css/front.css" type="text/css" charset="utf-8" />
    	<link type="text/css" href="../css/demo.css" rel="stylesheet" />
        <link type="text/css" href="../css/design.css" rel="stylesheet" />
</head>
<body>

 <div id="page">
<div id="wrapper">
        		 
        		   <div class="header_top" id="header_top"> </div>
  </div>
  <div class="header2"></div> 
	<div class="header"><!--open logo -->
		  </div><!--end header -->
	<!-- close logo-->
<!-- hide the client inquiries php-->
    <?php
    echo '<div id="nav">';
    echo '<div class="underlinemenu">';
	include('menu_view.php');
	echo '</div>';
    echo '</div>';
	?>
    <div id="header_in"> <!--open header -->
     <p> </p>
    
    <table width="100%" height="56">
     <tr>
       <td width="317" align="left" class="date"> 
        <? User::oras(); ?>
        </td>
            
       <td width="388" align="right"><? User::showPic(); ?></td>
       <td width="279">&nbsp;&nbsp;<? User::showUser(); ?>        </td>
       </tr>
   </table>
     
  
    </div>
    <div id="ex">
    </div>
    
      <p> </p>
       <div id="body"> <!--open body -->
    
	 <div id="sidebar"> 
        <div id="chef_ind"> <!--open chef --><!--close welcome-->

<? echo '<p class="more">';
echo '';
 
   require('sideBar.php');
    
echo'</p>';
?>

        </div>
        
      </div><!--close left -->
      
      <div id="content"> 
 <!-- -->
	   <div id="content"> 
      <div class="desriptionHeader"> <!--open right-->
       <?php
	
if (isset ($_GET['id'])) {
		$userid	= $_GET['id'];
	echo "<div class='post'><!--open booking -->
          <h2>Profile of $fullname</h2>
		  <p> </p>
		  <p class='right_'><a href='sendMessage.php?id=$userid'>Send Message</a></p>
            <div class='desriptionHeader'> <!--open right-->
       <div class='post'><!--open booking -->";
	   
	$data = mysql_query("SELECT * FROM tbluser u ,tblsection s WHERE u.userid = $userid AND u.user_type = 'teacher' GROUP BY userid;"); //where condition
	while($row = mysql_fetch_array($data)){	

	echo "
	Your Last Login was $row[lastlogin] 

		<br/><br/>
		
		
<table width='100%' border='0' cellspacing='0' cellpadding='0' style='height:30px'>
  <tr>
 	<td rowspan='7' width='10%'><div class='img_h' style='margin-left:10px'>
		<img src='profile_img/"."$row[avatar]"."' width='125px' />
	</div>&nbsp;
	</td>
	<td rowspan='6' width='5%'>&nbsp;</td>
    <td class='left_' width='30%'>Name</td>
    <td width='55%'>: $row[lname], $row[fname] $row[mname]</td>
  </tr>
  <tr>
    <td class='left_'>Address</td>
    <td>: $row[7], $row[addres]</td>
  </tr>
   <tr>
    <td class='left_'>Section</td>
    <td>: $row[7], $row[sectionName]</td>
  </tr>
  <tr>
    <td class='left_'>E-mail Add.</td>
    <td>: $row[email]</td>
  </tr>
  <tr>
    <td class='left_'>Contact Details</td>
    <td>: $row[cp]/$row[phone]</td>
  </tr>
  <tr>
    <td class='left_'>Birthday</td>
    <td>: $row[birthdate]</td>
  </tr>
  <tr>
    <td class='left_'>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  
  ";
  print("<tr>");
									print("<td align='right' colspan='7'>");
										print("<input value='Back' type='button' class='btn' onclick='history.go(-1); return false;'/>");
										
									print("</td>");
								print("</tr>");		
  }
  
  
}
  ?>
</table> 
      
	  </div><!--close booking -->
   </div><!--close desc -->
   
          
     				
	  </div><!--close booking -->
   </div><!--close desc -->
    	</div>
	 
<!--close desc -->
    	</div> <!--close right-->
      <div class="clear">&nbsp;</div>
 <!-- footer-->
 <?php 
	  echo '<div id="footer">';
     include('footer_view.php');
      echo '</div>';	
	  ?>

    </div><!-- close body-->
</div><!-- close page-->


</body>
</html>
